<?php

/**
 * Class Involved_ShopProductModel
 */

class Involved_ShopProductModel extends BaseModel
{

    protected $table = 'shop_product';

    /**
     * 商品列表
     * @return mixed
     */
    public function ProductList()
    {
        return  DB::table($this->table)
            ->select('product_id','product_name','price','category.cate_name','shop_brand.brand_name','specificate.spec_name','stock','shop_product.created','shop_product.is_show','img1','place','shop_product.business_id','shop_product.brand','shop_product.spec','shop_product.sort')
            ->join('shop_business','shop_business.business_id','=','shop_product.business_id')
            ->join('shop_brand','shop_brand.brand_id','=','shop_product.brand')
            ->join('specificate','specificate.s_id','=','shop_product.spec')
            ->join('category','category.c_id','=','shop_product.sort')
            ->get();
    }

    /**
     * 获取一条产品信息
     * @param $id
     * @return mixed
     */
    public function GetProductId($id)
    {
        return DB::table($this->table)
            ->select('product_id','product_name','price','category.cate_name','shop_brand.brand_name','specificate.spec_name','stock','shop_product.created','shop_product.is_show','img1','place','shop_product.business_id','shop_product.spec','shop_product.sort','img2','img3','shop_product.introduce','brand','shop_product.business_id')
            ->join('shop_business','shop_business.business_id','=','shop_product.business_id')
            ->join('shop_brand','shop_brand.brand_id','=','shop_product.brand')
            ->join('specificate','specificate.s_id','=','shop_product.spec')
            ->join('category','category.c_id','=','shop_product.sort')
            ->where('product_id',$id)
            ->first();
    }

}